<?php

namespace App\Jobs;

use App\servers\RabbitmqServer;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class SendSPodcast implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    private $productKey;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($data = null)
    {
        //
        $this->productKey = '发送的id'.$data->id;
        $rabbitmq = new RabbitmqServer();
        $rabbitmq->push('sendsms','exc_sms','pus_sms',$data);
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //
        $rabbitmq = new RabbitmqServer();

        $rabbitmq->pop('sendsms',function ($message){
            //调用发送短信方法，成功返回ture 或者 false
        });

    }
}
